package cn.wolfcode._IOday01_.synthesizeWork02;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        File file = new File("666.txt");

        FileReader reader = new FileReader(file);

        char[] ch = new char[200];
        int len ;
        String str = null;
        while((len=reader.read(ch)) != -1){
             str = new String(ch, 0, len);
        }
        //每个学生的信息
        String[] mes = str.split(";");
        Student[] sing1 = new Student[mes.length];
        for (int i = 0; i < mes.length; i++) {
            //每个学生的信息
            String[] sing = mes[i].split("-");
            int age = Integer.valueOf(sing[1]);
            double score = Double.valueOf(sing[2]);
            sing1[i] = new Student(sing[0],age,score);
        }
        double sum = 0;
        for(Student student : sing1){
            double score = student.getScore();
             sum += score ;
            System.out.println(student);
        }
        System.out.println(sum);

        //4、请写出String、int、Integer之间相互转换的代码。
        String p = "999" ;
        Integer a = Integer.valueOf(p);
        int a1 = Integer.valueOf(a);
        Integer a2 = Integer.valueOf(a1);
        String str2 = a2.toString();

        String st = "99";
        Integer in = Integer.valueOf (str);
        int l = Integer.valueOf(in);
        Integer in1 = Integer.valueOf(a);
        String st1 = in1.toString();
        int a5 = Integer.parseInt(st1);
        String so = Integer.toString(a5);


    }
}
